package ch09.shili;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class S05 {
    public static void main(String[] args) throws IOException {
        //读取文件内容
        InputStream fis = new FileInputStream("data/test2.txt");
        System.out.println("可读取的字节数:"+fis.available());

        byte[] words = new byte[fis.available()];

        fis.read(words);

        System.out.println(Arrays.toString(words));
        String str = new String(words,"UTF-8");
        System.out.println("转换后:"+str);
        fis.close();
    }
}
